<template>
  <div>
    <h1>关于</h1>
    <hr />
    <div>
      <b-button variant="success" @click="fetchGames()"
        >装载服务器数据</b-button
      >
      <hr />
      <ul>
        <li v-for="(item, index) in list" :key="index">
          {{ item.name }} - {{ item.price }}
        </li>
      </ul>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      list: []
    };
  },
  methods: {
    async fetchGames() {
      const data = await this.$axios.$get(
        "https://raw.githubusercontent.com/komavideo/LearnNuxtJS/main/games.json"
      );
      console.log(data);
      this.list = data;
    }
  }
};
</script>
